<template>
    <div class="template-form-Lu">
        <a-modal
            title=""
            :visible="applicationFormVisible"
            :maskClosable="false"
            :closable="true"
            :destroyOnClose="true"
            width="100%"
            :dialog-style="{ margin: '0 auto' }"
            wrapClassName="form-modal-Lu"
            @cancel="closeVisible">
            <template slot="footer" style="text-align:center;">
                <div v-if="linkName == '数据修订'">
                <a-button @click="editForm" class="blue-btn">确认修订</a-button>
                </div>
                <div v-else-if="linkName == '会议安排'">
                <a-button @click="beforSaveTable('提交')" class="blue-btn">确认会议安排</a-button>
                </div>
                <div v-else>
                <a-button v-if="showFooter == false" @click="saveTable('保存')">
                    保存
                </a-button>
                <a-button :loading="loading" v-if="showFooter == false" class="blue-btn" @click="beforSaveTable('提交')">
                    提交
                </a-button>
                <a-button v-if="showFooter == false && linkName !== '申请确认'" class="red-btn" @click="returnClick">
                    退回
                </a-button>
                <a-button v-if="showFooter" @click="closeVisible">关闭</a-button>
                </div>
            </template>
            <a-tabs type="card" v-if="applicationFormVisible" @change="callback">
                <a-tab-pane key="1" tab="申请表">
                    <div id="printTest" class="print-div-shu">
                        <a-form-model
                            ref="ruleForm"
                            :model="form"
                            :rules="rules"
                        >
                            <h1 class="h1-page">自治区食品药品审评查验中心会务保障登记表</h1>
                            <table border="1" cellspacing="0" class="table-Lu hys-table">
                                <tr>
                                    <th>会议内容</th>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'" colspan="5">
                                        <a-form-model-item ref="fhynr" prop="fhynr">
                                            <a-textarea v-model="form.fhynr" placeholder="请输入会议内容:" :auto-size="{ minRows: 2}"/>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else colspan="5" class="text-align-left">{{ form.fhynr }}</td>
                                </tr>
                                <tr>
                                    <th>会议时间</th>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'" colspan="5">
                                        <a-form-model-item class="conferenceRoomManagement-form-item">
                                            <!-- <a-range-picker
                                                :show-time="{ format: 'HH:mm' }"
                                                format="YYYY-MM-DD HH:mm"
                                                :placeholder="['会议开始时间', '会议结束时间']"
                                                v-model="form.time"
                                                @ok="onOk"
                                                style="width: 450px;"
                                                v-decorator="[
                                                'time', {initialValue:form.time,rules: rules.time}
                                                ]"
                                            /> -->
                                            <a-input-group compact>
                                                <a-date-picker
                                                    style="width: 55%"
                                                    v-model="timeForm.startDate"
                                                    type="date"
                                                    placeholder="会议开始时间"
                                                    @change="dateChange($event,'startDate')"
                                                    v-decorator="[ 'startDate', {initialValue:timeForm.startDate,rules: rules.startDate}]"/>
                                                    <a-time-picker
                                                    v-model="timeForm.startTime"
                                                        :minute-step="10"
                                                        format="HH:mm"
                                                        @change="startTimeChange"
                                                    />
                                            </a-input-group>
                                            <a-input-group compact>
                                                <a-date-picker
                                                    style="width: 55%"
                                                    v-model="timeForm.endDate"
                                                    type="date"
                                                    placeholder="会议结束时间"
                                                    @change="dateChange($event,'endDate')"/>
                                                    <a-time-picker
                                                        v-model="timeForm.endTime"
                                                        :minute-step="10"
                                                        format="HH:mm"
                                                        @change="endTimeChange"
                                                    />
                                            </a-input-group>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else colspan="5" class="text-align-left">
                                        {{ form.fhykssj }}  至  {{ form.fhyjssj }}
                                    </td>
                                </tr>
                                <tr>
                                    <th>会议地点</th>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'" colspan="5" class="text-align-left">
                                        <a-form-model-item ref="fhydd" prop="fhydd">
                                            <compSelector
                                                v-model:value="form.fhydd"
                                                :defaultValue="form.fhydd"
                                                :compType="typeSelect"
                                                dictionaryType="会议室名称"
                                                placeholder="请选择会议地点"
                                                style="width:300px;display:inline-block;"
                                                class="compSelector compSelectorHydd"
                                                @selectHandleChange="fhyddChange"/>
                                                <a-button v-if="linkName == '申请确认'" @click="searchUse" class="blue-btn" style="margin-right:10px;">查询是否可用</a-button>
                                                <a-button v-if="linkName == '申请确认'" @click="roomXiangQing" class="blue-btn">会议室详情</a-button>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else colspan="5" class="text-align-left">
                                        {{ form.fhydd }}
                                    </td>
                                </tr>
                                <tr v-if="linkName !== '申请确认'">
                                    <th>科室</th>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'">
                                        <a-form-model-item ref="fsyks" prop="fsyks">
                                        <compSelector
                                            :key="compSelectorkey"
                                            v-model="form.fsyks"
                                            :defaultValue="form.fsyks"
                                            :compType="typeSelect"
                                            class="compSelector"
                                            dictionaryType="OA申请科室单位"/>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else>{{ form.fsyks }}</td>
                                    <th>经办人</th>
                                    <td v-if="linkName == '数据修订'">
                                        <a-input
                                        v-model="form.fjbr">
                                        </a-input>
                                    </td>
                                    <td v-else>{{ form.fjbr }}</td>
                                    <th>联系电话</th>
                                    <td v-if="linkName == '数据修订'">
                                        <a-input
                                        v-model="form.flxdh">
                                        </a-input>
                                    </td>
                                    <td v-else>{{ form.flxdh }}</td>
                                </tr>
                                <tr>
                                    <th>中心领导</th>
                                    <th colspan="3">科室单位</th>
                                    <th style="line-height: 1.5;padding:0px;">
                                        外单位人员<br/>
                                        （单位或姓名）<br/>
                                        <a-input-number
                                        v-if="linkName == '申请确认'||linkName == '数据修订'"
                                        id="fwdwrys"
                                        v-model="form.fwdwrys"
                                        :min="0"
                                        class="form-item-div"/>
                                        <span v-else>{{ form.fwdwrys }}</span>
                                        人
                                    </th>
                                    <th></th>
                                </tr>
                                <tr>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'">
                                        <a-form-model-item ref="fzxld" prop="fzxld">
                                            <compSelector
                                                :key="compSelectorkey"
                                                v-model="form.fzxld"
                                                :defaultValue="form.fzxld"
                                                :compType="typeCheckbox"
                                                class="comp-select-box-a"
                                                dictionaryType="会议室中心领导"/>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else style="word-break: keep-all;padding-left: 10px;">{{ form.fzxld }}</td>
                                    <td colspan="3"  v-if="linkName == '申请确认'||linkName == '数据修订'" style="text-align: left;">
                                        <a-form-model-item ref="fksdw" prop="fksdw">
                                            <compSelector
                                                :key="compSelectorkey"
                                                :disabled="readOnly('申请确认')"
                                                v-model="form.fksdw"
                                                @selectHandleChange="selectHandleChange"
                                                :defaultValue="form.fksdw"
                                                :compType="typeCheckbox"
                                                class="comp-select-box-b"
                                                dictionaryType="OA申请科室单位"/>
                                        </a-form-model-item>
                                    </td>
                                    <td colspan="3" v-else style="word-break: keep-all;padding-left: 10px;">
                                        {{ form.fksdw }}
                                    </td>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'">
                                        <a-form-model-item ref="fzxld" prop="fzxld">
                                            <a-input
                                                placeholder="请输入外单位名称或外单位人员姓名"
                                                v-model="form.fwdwry"
                                                type="textarea"
                                                class="form-item-div"
                                                style="height: 200px;"/>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else style="word-break: keep-all;" class="text-align-left">
                                        {{ form.fwdwry }}
                                    </td>
                                    <td v-if="linkName == '申请确认'||linkName == '数据修订'" style="padding-left: 10px;">
                                        <a-form-model-item ref="fchry" prop="fchry">
                                            <span >
                                                参会人员<br/>
                                                <a-input-number
                                                id="fchry"
                                                v-model="form.fchry"
                                                :min="0"
                                                class="form-item-div"/><br/>
                                                人
                                            </span>
                                        </a-form-model-item>
                                    </td>
                                    <td v-else style="word-break: keep-all;">
                                        参会人员<br/>
                                        {{ form.fchry }}人
                                    </td>
                                </tr>
                                <tr>
                                    <th rowspan="4">工作要求</th>
                                    <td class="span-pa-left">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfycs">
                                        茶水
                                        </a-checkbox >
                                    </td>
                                    <td class="span-pa-left">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfykqs">
                                        矿泉水
                                        </a-checkbox >
                                    </td>
                                    <td class="span-pa-left">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfytq">
                                        台签
                                        </a-checkbox >
                                    </td>
                                    <td class="span-pa-left">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfyyx">
                                        音响
                                        </a-checkbox >
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="span-pa-left td-line-hei2">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfybjbdn">
                                        笔记本电脑
                                        </a-checkbox >
                                        <br/>
                                        <span v-show="form.fsfybjbdn == true" class="mar-left-shi">
                                        共
                                        <a-input-number
                                            v-if="linkName == '申请确认'||linkName == '数据修订'"
                                            @change="needNumber(form.fbjbdnyjt,'fsfybjbdn')"
                                            v-model="form.fbjbdnyjt"
                                            :min="0"
                                            class="number-input"/>
                                        <span v-else>{{ form.fbjbdnyjt }}</span>
                                        台
                                        </span>
                                    </td>
                                    <td class="span-pa-left td-line-hei2">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfytyy">
                                        投影仪
                                        </a-checkbox >
                                        <br/>
                                        <span v-show="form.fsfytyy == true" class="mar-left-shi">
                                        共
                                        <a-input-number
                                            v-if="linkName == '申请确认'||linkName == '数据修订'"
                                            @change="needNumber(form.ftyyyjt,'fsfytyy')"
                                            v-model="form.ftyyyjt"
                                            :min="0"
                                            class="number-input"/>
                                        <span v-else>{{ form.ftyyyjt }}</span>
                                        台
                                        </span>
                                    </td>
                                    <td class="span-pa-left td-line-hei2">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfyyxht">
                                        有线话筒
                                        </a-checkbox >
                                        <br/>
                                        <span v-show="form.fsfyyxht == true" class="mar-left-shi">
                                        共
                                        <a-input-number
                                            v-if="linkName == '申请确认'||linkName == '数据修订'"
                                            @change="needNumber(form.fyxhtyjz,'fsfyyxht')"
                                            v-model="form.fyxhtyjz"
                                            :min="0"
                                            class="number-input"/>
                                        <span v-else>{{ form.fyxhtyjz }}</span>
                                        支
                                        </span>
                                    </td>
                                    <td class="span-pa-left td-line-hei2">
                                        <a-checkbox
                                        :disabled="readOnly('申请确认')"
                                        v-model="form.fsfywxht">
                                        无线话筒
                                        </a-checkbox >
                                        <br/>
                                        <span v-show="form.fsfywxht == true" class="mar-left-shi">
                                        共
                                        <a-input-number
                                            v-if="linkName == '申请确认'||linkName == '数据修订'"
                                            @change="needNumber(form.fwxhtyjz,'fsfywxht')"
                                            v-model="form.fwxhtyjz"
                                            :min="0"
                                            class="number-input"/>
                                        <span v-else>{{ form.fwxhtyjz }}</span>
                                        支
                                        </span>
                                    </td>
                                    <td class="span-pa-left"></td>
                                </tr>
                                <tr>
                                    <th>会标内容</th>
                                    <td colspan="4">
                                        <a-textarea
                                            v-if="linkName =='申请确认'||linkName == '数据修订'"
                                            v-model="form.fhbnr"
                                            placeholder="请输入会标内容"
                                            :auto-size="{ minRows: 2}"/>
                                        <p v-else class="text-align-left">{{ form.fhbnr }}</p>
                                    </td>
                                </tr>
                                <tr>
                                    <th>备注</th>
                                    <td colspan="4">
                                        <a-textarea
                                            v-if="linkName =='申请确认'||linkName == '数据修订'"
                                            v-model="form.fbz"
                                            placeholder="请输入备注"
                                            :auto-size="{ minRows: 2}"/>
                                        <p v-else class="text-align-left">{{ form.fbz }}</p>
                                    </td>
                                </tr>
                                <tr>
                                    <th>科室领导<br/>意见</th>
                                    <td v-if="linkName == '科室审批' || linkName == '数据修订'" colspan="5">
                                        <a-form-model-item ref="fzbcsyj" prop="fzbcsyj">
                                            <reviewOpinions
                                              ref="reviewOpinionsRefKs"
                                              @getInputOpinion="getInputOpinion"
                                              @openOpinions="ksOpinions"
                                              v-decorator="[
                                                'fzbcsyj', {initialValue:form.fzbcsyj,rules: rules.fzbcsyj}]"/>
                                        </a-form-model-item>
                                        <div v-if="linkName == '数据修订'" class="yjqm-right-bottom">
                                            <a-input
                                                @click="checkMan('fzbcsyjr',form.fzbcsyjr)"
                                                v-model="form.fzbcsyjr"
                                                class="checkMan-Xiu"
                                                placeholder="指定科室待办人">
                                            </a-input>
                                            <a-date-picker
                                                show-time
                                                placeholder="科室负责人意见时间："
                                                v-model="form.fzbcsyjsj"
                                                @change="timeChang($event,'fzbcsyjsj')"
                                                class="checkTime-Xiu"/>
                                        </div>
                                    </td>
                                    <td v-else colspan="5">
                                        <div>
                                        <p class="text-align-left">{{ form.fzbcsyj }}</p>
                                        <div class="yjqm-right-bottom">
                                            <img v-if="getUrl('科室审批') && form.fzbcsyjsj" :src="getUrl('科室审批')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ form.fzbcsyjr }}</span>
                                            <span>{{ form.fzbcsyjsj }}</span>
                                        </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th>办公室<br/>意见</th>
                                    <td v-if="linkName == '办公室审批' || linkName == '数据修订'" colspan="5">
                                        <a-form-model-item ref="fbgsyj" prop="fbgsyj">
                                            <reviewOpinions
                                              ref="reviewOpinionsRefBgs"
                                              @getInputOpinion="getInputOpinion"
                                              @openOpinions="bgsOpinions"
                                              v-decorator="[
                                                'fbgsyj', {initialValue:form.fbgsyj,rules: rules.fbgsyj}]"/>
                                        </a-form-model-item>
                                        <div v-if="linkName == '数据修订'" class="yjqm-right-bottom">
                                            <a-input
                                                @click="checkMan('fbgsyjr',form.fbgsyjr)"
                                                v-model="form.fbgsyjr"
                                                class="checkMan-Xiu"
                                                placeholder="指定科室待办人">
                                            </a-input>
                                            <a-date-picker
                                                show-time
                                                placeholder="科室负责人意见时间："
                                                v-model="form.fbgsyjsj"
                                                @change="timeChang($event,'fbgsyjsj')"
                                                class="checkTime-Xiu"/>
                                        </div>
                                    </td>
                                    <td v-else colspan="5">
                                        <div>
                                        <p class="text-align-left">{{ form.fbgsyj }}</p>
                                        <div class="yjqm-right-bottom">
                                            <img v-if="getUrl('办公室审批') && form.fbgsyjsj" :src="getUrl('办公室审批')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ form.fbgsyjr }}</span>
                                            <span>{{ form.fbgsyjsj }}</span>
                                        </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr v-if="linkName !== '会议安排'">
                                    <th>会议安排</th>
                                    <td v-if="linkName == '数据修订'" colspan="5">
                                        <a-form-model-item ref="fhyapyj" prop="fhyapyj">
                                            <reviewOpinions
                                              ref="reviewOpinionsRefHyap"
                                              @getInputOpinion="getInputOpinion"
                                              @openOpinions="hyapOpinions"
                                              v-decorator="[
                                                'fhyapyj', {initialValue:form.fhyapyj,rules: rules.fhyapyj}]"/>
                                        </a-form-model-item>
                                        <div v-if="linkName == '数据修订'" class="yjqm-right-bottom">
                                            <a-input
                                                @click="checkMan('fhyapr',form.fhyapr)"
                                                v-model="form.fhyapr"
                                                class="checkMan-Xiu">
                                            </a-input>
                                            <a-date-picker
                                                show-time
                                                v-model="form.fhyapsj"
                                                @change="timeChang($event,'fhyapsj')"
                                                class="checkTime-Xiu"/>
                                        </div>
                                    </td>
                                    <td v-else colspan="5">
                                        <div>
                                        <p class="text-align-left">{{ form.fhyapyj }}</p>
                                        <div class="yjqm-right-bottom">
                                            <img v-if="getUrl('会议安排') && form.fhyapsj" :src="getUrl('会议安排')" class="yjqmImg"/>
                                            <span v-else class="yjqmImg">{{ form.fhyapr }}</span>
                                            <span>{{ form.fhyapsj }}</span>
                                        </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </a-form-model>
                    </div>
                </a-tab-pane>
                <a-tab-pane v-if="linkName == '我的已办'" key="2" tab="流转记录">
                    <a-table
                        :columns="lzColumns"
                        :data-source="lzList"
                        bordered
                        style="border-color: #d9d9d9;font-weight: 600;text-align: center;"
                        :customRow="customRow">
                    </a-table>
                </a-tab-pane>
                <a-button
                    v-if="showPrintBtn(linkName,form.flczt,tabsKey)"
                    slot="tabBarExtraContent"
                    type="primary"
                    v-print="printObj"
                    class="print-btn">
                    打印
                </a-button>
            </a-tabs>
        </a-modal>
        <a-modal
            title="会议室详情"
            :visible="xiangqingVisible"
            width="50%"
            :footer="false"
            @cancel="xiangqingVisible = false"
            >
            <xiangQing></xiangQing>
        </a-modal>
        <personnelList ref="personnelListRef" :modaObj="modaObj" @checkPersonnel="checkPersonnel"></personnelList>
    </div>
</template>
<script>
import compSelector from '@/components/compSelector/compSelector'
import xiangQing from '../meetingRoomDetails/index'
import {typeSelect, typeCheckbox, } from '@/components/compSearchCriteria/ContractType'
import {initBzFlow,saveFlow,submitFlow,hysSfky,flowJkPage,downMyQm,edit,queryAllYbJob,
        returnUpperzdyFlowJob} from './service/index'
import personnelList from '../../modal/personnelList'
import moment from 'moment'
export default {
  props:{
    formData:{
      type:[Array,Object],
      default: () => {},
      required:false
    },
    linkName:{
      type:String,
      default:'',
      required:false,
    },
  },
  components:{
    compSelector,xiangQing,personnelList
  },
  data() {
    return {
      moment:moment,
      loading: false,
    //   cform:this.$form.createForm(this, { name: 'cform' }),
      tabsKey: '1',
      rules:{
        time: [{
            type:'array',
            required: true,
            message: '请选择会议时间',
            trigger: 'blur',
        }],
        fhydd: [{
            required: true,
            message: '请选择会议地点',
            trigger: 'blur',
        }],
        fhynr: [{
            required: true,
            message: '请输入会议内容',
            trigger: 'blur',
        }],
        fzbcsyj: [{
            required: true,
            message: '请输入科室领导意见',
            trigger: 'blur',
        }],
        fbgsyj: [{
            required: true,
            message: '请输入办公室意见',
            trigger: 'blur',
        }],
        startDate: [{
            required: true,
            message: '请输入会议开始日期',
            trigger: 'change',
        }],
        startTime: [{
            required: true,
            message: '请输入会议开始时间',
            trigger: 'change',
        }],
        endDate: [{
            required: true,
            message: '请输入会议结束日期',
            trigger: 'change',
        }],
        endTime: [{
            required: true,
            message: '请输入会议结束时间',
            trigger: 'change',
        }],
      },
      formState: {},
      // formData: {},
      showFooter: false,
      form: {
        id: '',
        time: [],
        fbgsyj: "",
        fbgsyjr: "",
        fbgsyjrks: "",
        fbgsyjsj: "",
        fbjbdnyjt: "",
        fbz: "",
        fchry: 0,
        fcyyj: "",
        fgzyq: "",
        fhbnr: "",
        fhydd: "",
        fhyjssj: "",
        fhykssj: "",
        fhynr: "",
        fjbr: "",
        fjgfwzxbzyj: "",
        fjgfwzxbzyjr: "",
        fjgfwzxbzyjrks: "",
        fjgfwzxbzyjsj: "",
        fksdw: [],
        flczt: "",
        flxdh: "",
        frq: "",
        fsffqlc: "",
        fsfybjbdn: false,
        fsfycs: false,
        fsfykqs: false,
        fsfytq: false,
        fsfytyy: false,
        fsfywxht: false,
        fsfyyx: false,
        fsfyyxht: false,
        fsqbm: "",
        fsyks: "",
        ftyyyjt: "",
        // fuserid: "",
        fwdwry: "",
        fwdwrys: 0,
        fwxhtyjz: "",
        fxxzxjsbzyj: "",
        fxxzxjsbzyjr: "",
        fxxzxjsbzyjrks: "",
        fxxzxjsbzyjsj: "",
        fyxhtyjz: "",
        fzbcsyj: "",
        fzbcsyjr: "",
        fzbcsyjrks: "",
        fzbcsyjsj: "",
        fzxld: [],
        //
        fhyapr: "",
        fhyapsj: "",
        fhyapyj: "",
        fhyapks: ""
      },
      timeForm: {
        startDate: null,
        startTime: null,
        endDate: null,
        endTime: null,
      },
      kongForm: {},
      typeSelect:typeSelect,
      typeCheckbox:typeCheckbox,
      applicationFormVisible: false,
      compSelectorkey:null,
      // 工作要求
      needFsfybjbdn: false,
      needFsfytyy: false,
      needFsfyyxht: false,
      needFsfywxht: false,
      //
      xiangqingVisible: false,

      lzColumns: [
        {
          title: '环节名称',
          dataIndex: 'fhjmc',
          key: 'fhjmc',
          width: 150,
        },{
          title: '待办人',
          dataIndex: 'fdbr',
          key: 'fdbr',
          width: 100,
        },{
          title: '办理人',
          dataIndex: 'fblr',
          key: 'fblr',
          width: 100,
        },{
          title: '发送时间',
          dataIndex: 'ffssj',
          key: 'ffssj',
          width: 170,
        },{
          title: '办理时间',
          dataIndex: 'fblsj',
          key: 'fblsj',
          width: 170,
        },{
          title: '办理状态',
          dataIndex: 'fblzt',
          key: 'fblzt',
          width: 100,
        },{
          title: '办理类型',
          dataIndex: 'fbllx',
          key: 'fbllx',
          width: 300,
        },{
          title: '办理意见',
          dataIndex: 'fblyj',
          key: 'fblyj',
        },
      ],
      lzList: [],
      imgList: [
        {fhjmc:'科室审批',url: ''},
        {fhjmc:'办公室审批',url: ''},
        {fhjmc:'会议安排',url: ''},
      ],

      printObj:{
        id:"printTest", //需要打印的id名称
        popTitle:"会议室申请表",//文档的名称
        // preview:true,//预览功能，不好用
        zIndex:'20002',
        beforeOpenCallback(vue){
            // //console.log('打印回调',vue)
        },
        openCallback (vue) {//打开之前
            // //console.log('打开之前',vue)
        },
        closeCallback (vue) {//关闭了打印工具
            // //console.log('关闭了打印工具')
        },
      },

      modaObj: {},
      returnList: [],
      returmCheck: '',
      returnYj: '',

    }
  },
  // created() {
  // },
    mounted(){
        this.kongForm = JSON.parse(JSON.stringify(this.form))
        //console.log('kongForm',this.kongForm)
    },
    watch: {
        // formData:{
        formData(newval,oldVal){
            //console.log(newval)
            //console.log('linkName---',this.linkName)
            this.form = {...newval}
            this.form.fsfybjbdn = this.form.fsfybjbdn == '是'?true:false
            this.form.fsfycs = this.form.fsfycs == '是'?true:false
            this.form.fsfykqs = this.form.fsfykqs == '是'?true:false
            this.form.fsfytq = this.form.fsfytq == '是'?true:false
            this.form.fsfytyy = this.form.fsfytyy == '是'?true:false
            this.form.fsfywxht = this.form.fsfywxht == '是'?true:false
            this.form.fsfyyx = this.form.fsfyyx == '是'?true:false
            this.form.fsfyyxht = this.form.fsfyyxht == '是'?true:false
            // this.form.time = [moment(this.form.fhykssj),moment(this.form.fhyjssj)]
            this.timeForm.startDate = this.form.fhykssj?this.form.fhykssj.substr(0,10):''
            this.timeForm.startTime = this.form.fhykssj?moment(this.form.fhykssj.substr(11,5),'HH:mm'):''
            this.timeForm.endDate = this.form.fhyjssj?this.form.fhyjssj.substr(0,10):''
            this.timeForm.endTime = this.form.fhyjssj?moment(this.form.fhyjssj.substr(11,5),'HH:mm'):''
            if(this.linkName == '申请确认'||this.linkName == '数据修订'){
                this.form.fzxld = this.form.fzxld.split(',')
                this.form.fksdw = this.form.fksdw.split(',')
            }
            if(this.linkName == '流程监控'||this.linkName == '会议室申请记录'||this.linkName == '我的已办'){
                this.showFooter = true
            }
            let id = this.form.oaid
            this.getflowJkPage(id)
            // this.getqueryAllYbJob()
        },
    },
    methods: {
        showPrintBtn(linkName,flczt,tabsKey){
            if(linkName == '我的已办' && flczt == '流程结束' && tabsKey == '1'){
                return true
            } else {
                return false
            }
        },
        reviewRecordsFocusEvent(){},
        // 是否只读
        readOnly(type){
            if(this.linkName ==  type||this.linkName == '数据修订'){
                return false
            } else {
                return true
            }
        },
        selectHandleChange(val){
            //console.log('selectHandleChange',val)
        },
        fhyddChange(val){
            //console.log('fhyddChange',val)
            this.form.fhydd = val
            //   this.cform.setFieldsValue({
            //     fhydd:val,
            //   });
        },
        dateChange(val,name){
            let data = this.timeForm
            data[name] = val?moment(val).format('YYYY-MM-DD'):null
            //console.log(typeof data[name])
        },
        startTimeChange(time,timeString){
            //console.log(time,timeString)
            /* 用日期方式转换回显会Invalid date，所以只能在使用时才用转format */
            this.timeForm.startTime = time?moment(time,'HH:mm'):null
        },
        endTimeChange(time,timeString){
            //console.log(time,timeString)
            this.timeForm.endTime = time?moment(time,'HH:mm'):null
        },
        timeChang(val,name){
            let data = this.form
            data[name] = moment(val).format('YYYY-MM-DD HH:mm:ss')
        },
        timeFormValue(){
            if(this.timeForm.startDate&&this.timeForm.startTime&&this.timeForm.endDate&&this.timeForm.endTime){
                return true
            } else {
                return false
            }
        },
        callback(key) {
        // //console.log(key);
        this.tabsKey = key
        },
        customRow() {
        return {
            style: {
                'font-size' : '16px',
                'text-align' : 'center'
            },
        }
        },
        // 右上角关闭后的回调
        closeVisible(e){
        this.$emit('success')
        this.applicationFormVisible = false
        this.form = {...this.kongForm}
        this.time = []
        this.timeForm.startDate = null
        this.timeForm.startTime = null
        this.timeForm.endDate = null
        this.timeForm.endTime = null
        },
        onOk(value) {
        //   //console.log(typeof this.time) //object
        //console.log(value) //object
        this.form.time = value
        //   this.cform.setFieldsValue({
        //     fhykssj : moment(value[0]).format('YYYY-MM-DD HH:mm'),
        //     fhyjssj : moment(value[1]).format('YYYY-MM-DD HH:mm')
        //   })
        // this.form.fhykssj = moment(value[0]).format('YYYY-MM-DD HH:mm')
        // this.form.fhyjssj = moment(value[1]).format('YYYY-MM-DD HH:mm')
        },
        //---------
        // 签名时间
        timeChange(value,formItemName){
        formItemName = moment(value).format('YYYY-MM-DD HH:mm')
        },
        // 是否需要
        needNumber(num,needThing){
        const data = this.form
        // //console.log(data[needThing])
        if(num > 0){
            data[needThing] = true
        } else {
            data[needThing] = false
        }
    },
        // 打开意见弹窗
        ksOpinions(){
            this.$refs.reviewOpinionsRefKs.getData({opinionType:'ksIdeaType',oldVal:this.form.fzbcsyj,valueData:{hjmc:'fzbcsyj'}})
        },
        bgsOpinions(){
            this.$refs.reviewOpinionsRefBgs.getData({opinionType:'bgsIdeaType',oldVal:this.form.fbgsyj,valueData:{hjmc:'fbgsyj'}})
        },
        hyapOpinions(){
            this.$refs.reviewOpinionsRefHyap.getData({opinionType:'hyapIdeaType',oldVal:this.form.fhyapyj,valueData:{hjmc:'fhyapyj'}})
        },
        // 意见弹窗
        getInputOpinion(val,valueData){
        let data = this.form
        data[valueData.hjmc] = val
        //   this.cform.setFieldsValue({
        //     fzbcsyj:this.form.fzbcsyj,
        //     fbgsyj: this.form.fbgsyj,
        //     fjgfwzxbzyj: this.form.fjgfwzxbzyj,
        //     fxxzxjsbzyj: this.form.fxxzxjsbzyj,
        //     fhyapyj: this.form.fhyapyj
        //   });
        },
        checkMan(place,man){
        this.$nextTick(_ => {
            this.modaObj = {place: place,manList: man}
            this.$refs.personnelListRef.personnelListVisible = true
                })
        },
        // 选择人员
        checkPersonnel(place,id,name){
        this.$refs.personnelListRef.personnelListVisible = false
        //console.log('-------------------')
        const data = this.form
        data[place] = name.toString()
        data[fdbrid] = id.toString()
        data[fdbr] = name.toString()
        let Data = {
            jobid: this.form.jobid,
            fdbrid: id.toString(),
            fdbr: name.toString()
        }
        // zddbrFlows(Data).then(res => {
        //   //console.log(res)
        // })
        },
        // 查询会议室是否可用
        searchUse(){
            if(this.timeFormValue() && this.form.fhydd){
                let data = {
                    fhykssj: this.timeForm.startDate + ' ' + moment(this.timeForm.startTime).format('HH:mm'),
                    fhyjssj: this.timeForm.endDate + ' ' + moment(this.timeForm.endTime).format('HH:mm'),
                    fhydd: this.form.fhydd,
                }
                hysSfky(data).then(res => {
                    if(res.code == 200){
                    this.$message.success(res.message)
                    } else {
                    this.$message.warning(res.message)
                    }
                })
            } else {
                this.$message.warning('请填写完整会议开始时间，会议结束时间及会议地点。')
            }
        },
        // 会议室详情
        roomXiangQing(){
            this.xiangqingVisible = true
        },
        beforSaveTable(str){
            this.$refs.ruleForm.validate(valid => {
                if(valid) {
                    var that = this
                    that.$confirm({
                        title: '您确定要提交吗?',
                        onOk() {
                            let fksdwStr = ''
                            let fzxldStr = ''
                            if(that.form.fksdw){
                                fksdwStr = that.form.fksdw.toString()
                            }
                            if(that.form.fzxld){
                                fzxldStr = that.form.fzxld.toString()
                            }
                            let data = {}
                            if(that.linkName == '申请确认'){
                                if(that.timeFormValue()){
                                    if(that.form.id){
                                        data = {
                                            jobid: that.form.jobid,
                                            oaid: that.form.id,
                                            map: {
                                            fbjbdnyjt: that.form.fbjbdnyjt,
                                            fbz: that.form.fbz,
                                            fchry: that.form.fchry,
                                            fcyyj: that.form.fcyyj,
                                            fgzyq: that.form.fgzyq,
                                            fhbnr: that.form.fhbnr,
                                            fhydd: that.form.fhydd,
                                            fhyjssj: that.timeForm.endDate + ' ' + moment(that.timeForm.endTime).format('HH:mm'),
                                            fhykssj: that.timeForm.startDate + ' ' + moment(that.timeForm.startTime).format('HH:mm'),
                                            fhynr: that.form.fhynr,
                                            fjbr: that.form.fjbr,
                                            fksdw: fksdwStr,
                                            flczt: that.form.flczt,
                                            flxdh: that.form.flxdh,
                                            frq: that.form.frq,
                                            fsffqlc: that.form.fsffqlc,
                                            fsfybjbdn: that.form.fsfybjbdn==true?'是':'',
                                            fsfycs: that.form.fsfycs== true?'是':'',
                                            fsfykqs: that.form.fsfykqs== true?'是':'',
                                            fsfytq: that.form.fsfytq== true?'是':'',
                                            fsfytyy: that.form.fsfytyy== true?'是':'',
                                            fsfywxht: that.form.fsfywxht== true?'是':'',
                                            fsfyyx: that.form.fsfyyx== true?'是':'',
                                            fsfyyxht: that.form.fsfyyxht== true?'是':'',
                                            fsqbm: that.form.fsqbm,
                                            fsyks: that.form.fsyks,
                                            ftyyyjt: that.form.ftyyyjt,
                                            fwdwry: that.form.fwdwry,
                                            fwdwrys: that.form.fwdwrys,
                                            fwxhtyjz: that.form.fwxhtyjz,
                                            fyxhtyjz: that.form.fyxhtyjz,
                                            fzxld: fzxldStr,
                                            },
                                            currentNode: "",
                                            dbrid: "",
                                            lcmbCode: "",
                                            nextNode: "",
                                            nextNodeId: "",
                                            opinion: "",
                                            smgflag: ""
                                        }
                                    if(str == '提交'){
                                        data = {
                                        ...data,
                                        fsffqlc: '是'
                                        }
                                        that.loading = true
                                        submitFlow(data).then(res => {
                                        // //console.log(res)
                                        if(res.code == 200){
                                            that.$message.success(res.message)
                                            that.closeVisible()
                                        } else {
                                            that.$message.warning(res.message)
                                        }
                                        that.loading = false
                                        })
                                    } else {
                                        data = {
                                            id: that.form.id,
                                            fbjbdnyjt: that.form.fbjbdnyjt,
                                            fbz: that.form.fbz,
                                            fchry: that.form.fchry,
                                            fcyyj: that.form.fcyyj,
                                            fgzyq: that.form.fgzyq,
                                            fhbnr: that.form.fhbnr,
                                            fhydd: that.form.fhydd,
                                            fhyjssj: that.timeForm.endDate + ' ' + moment(that.timeForm.endTime).format('HH:mm'),
                                            fhykssj: that.timeForm.startDate + ' ' + moment(that.timeForm.startTime).format('HH:mm'),
                                            fhynr: that.form.fhynr,
                                            fjbr: that.form.fjbr,
                                            fksdw: fksdwStr,
                                            flczt: that.form.flczt,
                                            flxdh: that.form.flxdh,
                                            frq: that.form.frq,
                                            fsffqlc: that.form.fsffqlc,
                                            fsfybjbdn: that.form.fsfybjbdn==true?'是':'',
                                            fsfycs: that.form.fsfycs== true?'是':'',
                                            fsfykqs: that.form.fsfykqs== true?'是':'',
                                            fsfytq: that.form.fsfytq== true?'是':'',
                                            fsfytyy: that.form.fsfytyy== true?'是':'',
                                            fsfywxht: that.form.fsfywxht== true?'是':'',
                                            fsfyyx: that.form.fsfyyx== true?'是':'',
                                            fsfyyxht: that.form.fsfyyxht== true?'是':'',
                                            fsqbm: that.form.fsqbm,
                                            fsyks: that.form.fsyks,
                                            ftyyyjt: that.form.ftyyyjt,
                                            fwdwry: that.form.fwdwry,
                                            fwdwrys: that.form.fwdwrys,
                                            fwxhtyjz: that.form.fwxhtyjz,
                                            fyxhtyjz: that.form.fyxhtyjz,
                                            fzxld: fzxldStr,
                                        }
                                        initBzFlow(data).then(res => {
                                            if(res.code == 200){
                                                that.$message.success(res.message)
                                                that.form = {
                                                    ...res.result.oaMap,
                                                    jobid: res.result.jobMap.id
                                                }
                                                that.form.fsfybjbdn = that.form.fsfybjbdn == '是'?true:false
                                                that.form.fsfycs = that.form.fsfycs == '是'?true:false
                                                that.form.fsfykqs = that.form.fsfykqs == '是'?true:false
                                                that.form.fsfytq = that.form.fsfytq == '是'?true:false
                                                that.form.fsfytyy = that.form.fsfytyy == '是'?true:false
                                                that.form.fsfywxht = that.form.fsfywxht == '是'?true:false
                                                that.form.fsfyyx = that.form.fsfyyx == '是'?true:false
                                                that.form.fsfyyxht = that.form.fsfyyxht == '是'?true:false
                                                // that.form.time = [moment(that.form.fhykssj),moment(that.form.fhyjssj)]
                                                that.timeForm.startDate = that.form.fhykssj.substr(0,10)
                                                that.timeForm.startTime = moment(that.form.fhykssj.substr(11,5),'HH:mm')
                                                that.timeForm.endDate = that.form.fhyjssj.substr(0,10)
                                                that.timeForm.endTime = moment(that.form.fhyjssj.substr(11,5),'HH:mm')
                                                that.form.fzxld = that.form.fzxld.split(',')
                                                that.form.fksdw = that.form.fksdw.split(',')
                                            } else {
                                                that.$message.warning(res.message)
                                            }
                                        })
                                    }
                                    } else {
                                        data = {
                                            id: that.form.id,
                                            fbjbdnyjt: that.form.fbjbdnyjt,
                                            fbz: that.form.fbz,
                                            fchry: that.form.fchry,
                                            fcyyj: that.form.fcyyj,
                                            fgzyq: that.form.fgzyq,
                                            fhbnr: that.form.fhbnr,
                                            fhydd: that.form.fhydd,
                                            fhyjssj: that.timeForm.endDate + ' ' + moment(that.timeForm.endTime).format('HH:mm'),
                                            fhykssj:  that.timeForm.startDate + ' ' + moment(that.timeForm.startTime).format('HH:mm'),
                                            fhynr: that.form.fhynr,
                                            fjbr: that.form.fjbr,
                                            fksdw: fksdwStr,
                                            flczt: that.form.flczt,
                                            flxdh: that.form.flxdh,
                                            frq: that.form.frq,
                                            fsffqlc: that.form.fsffqlc,
                                            fsfybjbdn: that.form.fsfybjbdn==true?'是':'',
                                            fsfycs: that.form.fsfycs== true?'是':'',
                                            fsfykqs: that.form.fsfykqs== true?'是':'',
                                            fsfytq: that.form.fsfytq== true?'是':'',
                                            fsfytyy: that.form.fsfytyy== true?'是':'',
                                            fsfywxht: that.form.fsfywxht== true?'是':'',
                                            fsfyyx: that.form.fsfyyx== true?'是':'',
                                            fsfyyxht: that.form.fsfyyxht== true?'是':'',
                                            fsqbm: that.form.fsqbm,
                                            fsyks: that.form.fsyks,
                                            ftyyyjt: that.form.ftyyyjt,
                                            fwdwry: that.form.fwdwry,
                                            fwdwrys: that.form.fwdwrys,
                                            fwxhtyjz: that.form.fwxhtyjz,
                                            fyxhtyjz: that.form.fyxhtyjz,
                                            fzxld: fzxldStr,
                                        }
                                        if(str == '提交'){
                                            data = {
                                            ...data,
                                            fsffqlc: '是'
                                            }
                                            that.loading = true
                                        }
                                        initBzFlow(data).then(res => {
                                            if(res.code == 200){
                                            that.$message.success(res.message)
                                            if(str == '提交'){
                                                that.closeVisible()
                                            } else {
                                                that.form = {
                                                ...res.result.oaMap,
                                                jobid: res.result.jobMap.id
                                                }
                                                that.form.fsfybjbdn = that.form.fsfybjbdn == '是'?true:false
                                                that.form.fsfycs = that.form.fsfycs == '是'?true:false
                                                that.form.fsfykqs = that.form.fsfykqs == '是'?true:false
                                                that.form.fsfytq = that.form.fsfytq == '是'?true:false
                                                that.form.fsfytyy = that.form.fsfytyy == '是'?true:false
                                                that.form.fsfywxht = that.form.fsfywxht == '是'?true:false
                                                that.form.fsfyyx = that.form.fsfyyx == '是'?true:false
                                                that.form.fsfyyxht = that.form.fsfyyxht == '是'?true:false
                                                // that.form.time = [that.form.fhykssj,that.form.fhyjssj]
                                                that.timeForm.startDate = that.form.fhykssj.substr(0,10)
                                                that.timeForm.startTime = moment(that.form.fhykssj.substr(11,5),'HH:mm')
                                                that.timeForm.endDate = that.form.fhyjssj.substr(0,10)
                                                that.timeForm.endTime = moment(that.form.fhyjssj.substr(11,5),'HH:mm')
                                                that.form.fzxld = that.form.fzxld.split(',')
                                                that.form.fksdw = that.form.fksdw.split(',')
                                            }
                                            that.$emit('success')
                                            } else {
                                            that.$message.warning(res.message)
                                            }
                                            that.loading = false
                                        })
                                    }
                                } else {
                                    that.$message.warning('请填写完整会议开始日期、时间，会议结束日期、时间。')
                                }
                            } else if(that.linkName == '科室审批'){
                                let data = {
                                jobid: that.form.jobid,
                                oaid: that.form.id,
                                map: {
                                    fzbcsyj: that.form.fzbcsyj,
                                    fzbcsyjr: that.form.fzbcsyjr,
                                    fzbcsyjsj: that.form.fzbcsyjsj,
                                    fzbcsyjrks: that.form.fsyks,
                                },
                                opinion: that.form.fzbcsyj,
                                currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                if(str == '提交'){
                                data = {
                                    ...data,
                                    fsffqlc: '是'
                                }
                                submitFlow(data).then(res => {
                                    // //console.log(res)
                                    if(res.code == 200){
                                        that.$message.success(res.message)
                                        that.closeVisible()
                                    } else {
                                        that.$message.warning(res.message)
                                    }
                                })
                                } else {
                                saveFlow(data).then(res => {
                                    // //console.log(res)
                                    if(res.code == 200){
                                    that.$message.success(res.message)
                                    } else {
                                    that.$message.warning(res.message)
                                    }
                                })
                                }
                            } else if(that.linkName == '办公室审批'){
                                let data = {
                                jobid: that.form.jobid,
                                oaid: that.form.id,
                                map: {
                                    fbgsyj: that.form.fbgsyj,
                                    fbgsyjr: that.form.fbgsyjr,
                                    fbgsyjrks: that.form.fbgsyjrks,
                                    fbgsyjsj: that.form.fbgsyjsj
                                },
                                opinion: that.form.fbgsyj,
                                currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                if(str == '提交'){
                                data = {
                                    ...data,
                                    fsffqlc: '是'
                                }
                                submitFlow(data).then(res => {
                                    // //console.log(res)
                                    if(res.code == 200){
                                        that.$message.success(res.message)
                                        that.closeVisible()
                                    } else {
                                        that.$message.warning(res.message)
                                    }
                                })
                                } else {
                                saveFlow(data).then(res => {
                                    // //console.log(res)
                                    if(res.code == 200){
                                    that.$message.success(res.message)
                                    } else {
                                    that.$message.warning(res.message)
                                    }
                                })
                                }
                            } else if(that.linkName == '会议安排'){
                                let data = {
                                jobid: that.form.jobid,
                                oaid: that.form.id,
                                map: {
                                    fhyapr: that.form.fhyapr,
                                    fhyapsj: that.form.fhyapsj,
                                    fhyapyj: '同意会议安排',
                                    fhyapks: that.form.fhyapks
                                },
                                opinion: '同意会议安排',
                                currentNode: "",
                                    dbrid: "",
                                    lcmbCode: "",
                                    nextNode: "",
                                    nextNodeId: "",
                                    smgflag: ""
                                }
                                if(str == '提交'){
                                data = {
                                    ...data,
                                    fsffqlc: '是'
                                }
                                submitFlow(data).then(res => {
                                    // //console.log(res)
                                    if(res.code == 200){
                                        that.$message.success(res.message)
                                        that.closeVisible()
                                    } else {
                                        that.$message.warning(res.message)
                                    }
                                })
                                } else {
                                saveFlow(data).then(res => {
                                    // //console.log(res)
                                    if(res.code == 200){
                                    that.$message.success(res.message)
                                    } else {
                                    that.$message.warning(res.message)
                                    }
                                })
                                }
                            }
                        },
                        onCancel() {},
                    });
                } else {
                    this.$message.warning('有未填的必填项')
                }
            })
        },
        saveTable(str){
            let fksdwStr = ''
            let fzxldStr = ''
            if(this.form.fksdw){
                fksdwStr = this.form.fksdw.toString()
            }
            if(this.form.fzxld){
                fzxldStr = this.form.fzxld.toString()
            }
            let data = {}
            if(this.linkName == '申请确认'){
                if(this.form.id){
                    data = {
                        jobid: this.form.jobid,
                        oaid: this.form.id,
                        map: {
                        fbjbdnyjt: this.form.fbjbdnyjt,
                        fbz: this.form.fbz,
                        fchry: this.form.fchry,
                        fcyyj: this.form.fcyyj,
                        fgzyq: this.form.fgzyq,
                        fhbnr: this.form.fhbnr,
                        fhydd: this.form.fhydd,
                        fhyjssj: this.timeForm.endDate?(this.timeForm.endDate + ' ' + moment(this.timeForm.endTime).format('HH:mm')):'',
                        fhykssj: this.timeForm.startDate?(this.timeForm.startDate + ' ' + moment(this.timeForm.startTime).format('HH:mm')):'',
                        fhynr: this.form.fhynr,
                        fjbr: this.form.fjbr,
                        fksdw: fksdwStr,
                        flczt: this.form.flczt,
                        flxdh: this.form.flxdh,
                        frq: this.form.frq,
                        fsffqlc: this.form.fsffqlc,
                        fsfybjbdn: this.form.fsfybjbdn==true?'是':'',
                        fsfycs: this.form.fsfycs== true?'是':'',
                        fsfykqs: this.form.fsfykqs== true?'是':'',
                        fsfytq: this.form.fsfytq== true?'是':'',
                        fsfytyy: this.form.fsfytyy== true?'是':'',
                        fsfywxht: this.form.fsfywxht== true?'是':'',
                        fsfyyx: this.form.fsfyyx== true?'是':'',
                        fsfyyxht: this.form.fsfyyxht== true?'是':'',
                        fsqbm: this.form.fsqbm,
                        fsyks: this.form.fsyks,
                        ftyyyjt: this.form.ftyyyjt,
                        fwdwry: this.form.fwdwry,
                        fwdwrys: this.form.fwdwrys,
                        fwxhtyjz: this.form.fwxhtyjz,
                        fyxhtyjz: this.form.fyxhtyjz,
                        fzxld: fzxldStr,
                        },
                        currentNode: "",
                        dbrid: "",
                        lcmbCode: "",
                        nextNode: "",
                        nextNodeId: "",
                        opinion: "",
                        smgflag: ""
                    }
                if(str == '提交'){
                    data = {
                    ...data,
                    fsffqlc: '是'
                    }
                    this.loading = true
                    submitFlow(data).then(res => {
                        // //console.log(res)
                        if(res.code == 200){
                            this.$message.success(res.message)
                            this.closeVisible()
                        } else {
                            this.$message.warning(res.message)
                        }
                        this.loading = false
                    })
                } else {
                    data = {
                        id: this.form.id,
                        fbjbdnyjt: this.form.fbjbdnyjt,
                        fbz: this.form.fbz,
                        fchry: this.form.fchry,
                        fcyyj: this.form.fcyyj,
                        fgzyq: this.form.fgzyq,
                        fhbnr: this.form.fhbnr,
                        fhydd: this.form.fhydd,
                        fhyjssj: this.timeForm.endDate?(this.timeForm.endDate + ' ' + moment(this.timeForm.endTime).format('HH:mm')):'',
                        fhykssj: this.timeForm.startDate?(this.timeForm.startDate + ' ' + moment(this.timeForm.startTime).format('HH:mm')):'',
                        fhynr: this.form.fhynr,
                        fjbr: this.form.fjbr,
                        fksdw: fksdwStr,
                        flczt: this.form.flczt,
                        flxdh: this.form.flxdh,
                        frq: this.form.frq,
                        fsffqlc: this.form.fsffqlc,
                        fsfybjbdn: this.form.fsfybjbdn==true?'是':'',
                        fsfycs: this.form.fsfycs== true?'是':'',
                        fsfykqs: this.form.fsfykqs== true?'是':'',
                        fsfytq: this.form.fsfytq== true?'是':'',
                        fsfytyy: this.form.fsfytyy== true?'是':'',
                        fsfywxht: this.form.fsfywxht== true?'是':'',
                        fsfyyx: this.form.fsfyyx== true?'是':'',
                        fsfyyxht: this.form.fsfyyxht== true?'是':'',
                        fsqbm: this.form.fsqbm,
                        fsyks: this.form.fsyks,
                        ftyyyjt: this.form.ftyyyjt,
                        fwdwry: this.form.fwdwry,
                        fwdwrys: this.form.fwdwrys,
                        fwxhtyjz: this.form.fwxhtyjz,
                        fyxhtyjz: this.form.fyxhtyjz,
                        fzxld: fzxldStr,
                    }
                    initBzFlow(data).then(res => {
                        if(res.code == 200){
                            this.$message.success(res.message)
                            this.form = {
                                ...res.result.oaMap,
                                jobid: res.result.jobMap.id
                            }
                            this.form.fsfybjbdn = this.form.fsfybjbdn == '是'?true:false
                            this.form.fsfycs = this.form.fsfycs == '是'?true:false
                            this.form.fsfykqs = this.form.fsfykqs == '是'?true:false
                            this.form.fsfytq = this.form.fsfytq == '是'?true:false
                            this.form.fsfytyy = this.form.fsfytyy == '是'?true:false
                            this.form.fsfywxht = this.form.fsfywxht == '是'?true:false
                            this.form.fsfyyx = this.form.fsfyyx == '是'?true:false
                            this.form.fsfyyxht = this.form.fsfyyxht == '是'?true:false
                            // this.form.time = [moment(this.form.fhykssj),moment(this.form.fhyjssj)]
                            this.timeForm.startDate = this.form.fhykssj?this.form.fhykssj.substr(0,10):''
                            this.timeForm.startTime = this.form.fhykssj?moment(this.form.fhykssj.substr(11,5),'HH:mm'):''
                            this.timeForm.endDate = this.form.fhyjssj?this.form.fhyjssj.substr(0,10):''
                            this.timeForm.endTime = this.form.fhyjssj?moment(this.form.fhyjssj.substr(11,5),'HH:mm'):''
                            this.form.fzxld = this.form.fzxld.split(',')
                            this.form.fksdw = this.form.fksdw.split(',')
                        } else {
                            this.$message.warning(res.message)
                        }
                    })
                }
                } else {
                    data = {
                        id: this.form.id,
                        fbjbdnyjt: this.form.fbjbdnyjt,
                        fbz: this.form.fbz,
                        fchry: this.form.fchry,
                        fcyyj: this.form.fcyyj,
                        fgzyq: this.form.fgzyq,
                        fhbnr: this.form.fhbnr,
                        fhydd: this.form.fhydd,
                        fhyjssj: this.timeForm.endDate?(this.timeForm.endDate + ' ' + moment(this.timeForm.endTime).format('HH:mm')):'',
                        fhykssj: this.timeForm.startDate?(this.timeForm.startDate + ' ' + moment(this.timeForm.startTime).format('HH:mm')):'',
                        fhynr: this.form.fhynr,
                        fjbr: this.form.fjbr,
                        fksdw: fksdwStr,
                        flczt: this.form.flczt,
                        flxdh: this.form.flxdh,
                        frq: this.form.frq,
                        fsffqlc: this.form.fsffqlc,
                        fsfybjbdn: this.form.fsfybjbdn==true?'是':'',
                        fsfycs: this.form.fsfycs== true?'是':'',
                        fsfykqs: this.form.fsfykqs== true?'是':'',
                        fsfytq: this.form.fsfytq== true?'是':'',
                        fsfytyy: this.form.fsfytyy== true?'是':'',
                        fsfywxht: this.form.fsfywxht== true?'是':'',
                        fsfyyx: this.form.fsfyyx== true?'是':'',
                        fsfyyxht: this.form.fsfyyxht== true?'是':'',
                        fsqbm: this.form.fsqbm,
                        fsyks: this.form.fsyks,
                        ftyyyjt: this.form.ftyyyjt,
                        fwdwry: this.form.fwdwry,
                        fwdwrys: this.form.fwdwrys,
                        fwxhtyjz: this.form.fwxhtyjz,
                        fyxhtyjz: this.form.fyxhtyjz,
                        fzxld: fzxldStr,
                    }
                    if(str == '提交'){
                        data = {
                        ...data,
                        fsffqlc: '是'
                        }
                        this.loading = true
                    }
                    initBzFlow(data).then(res => {
                        if(res.code == 200){
                        this.$message.success(res.message)
                        if(str == '提交'){
                            this.closeVisible()
                        } else {
                            this.form = {
                            ...res.result.oaMap,
                            jobid: res.result.jobMap.id
                            }
                            this.form.fsfybjbdn = this.form.fsfybjbdn == '是'?true:false
                            this.form.fsfycs = this.form.fsfycs == '是'?true:false
                            this.form.fsfykqs = this.form.fsfykqs == '是'?true:false
                            this.form.fsfytq = this.form.fsfytq == '是'?true:false
                            this.form.fsfytyy = this.form.fsfytyy == '是'?true:false
                            this.form.fsfywxht = this.form.fsfywxht == '是'?true:false
                            this.form.fsfyyx = this.form.fsfyyx == '是'?true:false
                            this.form.fsfyyxht = this.form.fsfyyxht == '是'?true:false
                            // this.form.time = [this.form.fhykssj,this.form.fhyjssj]
                            this.timeForm.startDate = this.form.fhykssj?this.form.fhykssj.substr(0,10):''
                            this.timeForm.startTime = this.form.fhykssj?moment(this.form.fhykssj.substr(11,5),'HH:mm'):''
                            this.timeForm.endDate = this.form.fhyjssj?this.form.fhyjssj.substr(0,10):''
                            this.timeForm.endTime = this.form.fhyjssj?moment(this.form.fhyjssj.substr(11,5),'HH:mm'):''
                            this.form.fzxld = this.form.fzxld.split(',')
                            this.form.fksdw = this.form.fksdw.split(',')
                        }
                        this.$emit('success')
                        } else {
                        this.$message.warning(res.message)
                        }
                        this.loading = false
                    })
                }
            } else if(this.linkName == '科室审批'){
                let data = {
                jobid: this.form.jobid,
                oaid: this.form.id,
                map: {
                    fzbcsyj: this.form.fzbcsyj,
                    fzbcsyjr: this.form.fzbcsyjr,
                    fzbcsyjsj: this.form.fzbcsyjsj,
                    fzbcsyjrks: this.form.fsyks,
                },
                opinion: this.form.fzbcsyj,
                currentNode: "",
                    dbrid: "",
                    lcmbCode: "",
                    nextNode: "",
                    nextNodeId: "",
                    smgflag: ""
                }
                if(str == '提交'){
                  data = {
                      ...data,
                      fsffqlc: '是'
                  }
                  submitFlow(data).then(res => {
                      // //console.log(res)
                      if(res.code == 200){
                        this.$message.success(res.message)
                        this.closeVisible()
                      } else {
                        this.$message.warning(res.message)
                      }
                  })
                } else {
                  saveFlow(data).then(res => {
                      // //console.log(res)
                      if(res.code == 200){
                      this.$message.success(res.message)
                      } else {
                      this.$message.warning(res.message)
                      }
                  })
                }
            } else if(this.linkName == '办公室审批'){
                let data = {
                jobid: this.form.jobid,
                oaid: this.form.id,
                map: {
                    fbgsyj: this.form.fbgsyj,
                    fbgsyjr: this.form.fbgsyjr,
                    fbgsyjrks: this.form.fbgsyjrks,
                    fbgsyjsj: this.form.fbgsyjsj
                },
                opinion: this.form.fbgsyj,
                currentNode: "",
                    dbrid: "",
                    lcmbCode: "",
                    nextNode: "",
                    nextNodeId: "",
                    smgflag: ""
                }
                if(str == '提交'){
                  data = {
                      ...data,
                      fsffqlc: '是'
                  }
                  submitFlow(data).then(res => {
                      // //console.log(res)
                      if(res.code == 200){
                        this.$message.success(res.message)
                        this.closeVisible()
                      } else {
                        this.$message.warning(res.message)
                      }
                  })
                } else {
                  saveFlow(data).then(res => {
                      // //console.log(res)
                      if(res.code == 200){
                      this.$message.success(res.message)
                      } else {
                      this.$message.warning(res.message)
                      }
                  })
                }
            } else if(this.linkName == '会议安排'){
                let data = {
                jobid: this.form.jobid,
                oaid: this.form.id,
                map: {
                    fhyapr: this.form.fhyapr,
                    fhyapsj: this.form.fhyapsj,
                    fhyapyj: '同意会议安排',
                    fhyapks: this.form.fhyapks
                },
                opinion: '同意会议安排',
                currentNode: "",
                    dbrid: "",
                    lcmbCode: "",
                    nextNode: "",
                    nextNodeId: "",
                    smgflag: ""
                }
                if(str == '提交'){
                  data = {
                      ...data,
                      fsffqlc: '是'
                  }
                  submitFlow(data).then(res => {
                      // //console.log(res)
                      if(res.code == 200){
                        this.$message.success(res.message)
                        this.closeVisible()
                      } else {
                        this.$message.warning(res.message)
                      }
                  })
                } else {
                  saveFlow(data).then(res => {
                      // //console.log(res)
                      if(res.code == 200){
                      this.$message.success(res.message)
                      } else {
                      this.$message.warning(res.message)
                      }
                  })
                }
            }
        },
        //流转记录
        getflowJkPage(id){
        flowJkPage({oaid:id}).then(res => {
            let arr1 = []
                arr1 = res.result.records
            // var arr1 = [1, 2, 3, 4, 5, 6, 7];
            var arr2 = new Array();
            for (let i = arr1.length - 1; i >= 0; i--) {
            arr2.push(arr1[i]);
            }
            // //console.log('arr2',arr2)
            this.lzList = []
            arr1.forEach(item => {
            item = {
                ...item,
                key: item.jobid
            }
            this.lzList.push(item)
            this.imgList.forEach((items,a)=> {
                if(item.fdbrid){
                if(items.fhjmc == item.fhjmc){
                    downMyQm({id:item.fdbrid}).then(resa => {
                      if(resa.code){
                        this.imgList[a].url = null
                      } else {
                        this.imgList[a].url = "data:image/png;base64," +
                        btoa( new Uint8Array(resa).reduce( (data, byte) => data + String.fromCharCode(byte), "" ))
                      }
                    })
                }
                } else {}
            })
            //console.log('imgList',this.imgList)
            })
        })
        },
        getUrl(ids){
        let url = ''
        this.imgList.forEach(item => {
            if(item.fhjmc == ids){
            url = item.url
            }
        })
        // //console.log('长度',url.length)
        return url
        },
        // 数据修订
        editForm(){
        let fksdwStr = ''
        let fzxldStr = ''
        if(this.form.fksdw){
            fksdwStr = this.form.fksdw.toString()
        }
        if(this.form.fzxld){
            fzxldStr = this.form.fzxld.toString()
        }
        let data = {
            id : this.form.oaid,
            fbgsyj : this.form.fbgsyj,
            fbgsyjr : this.form.fbgsyjr,
            fbgsyjrks : this.form.fbgsyjrks,
            fbgsyjsj : this.form.fbgsyjsj,
            fbjbdnyjt : this.form.fbjbdnyjt,
            fbz : this.form.fbz,
            fchry : this.form.fchry,
            fcyyj : this.form.fcyyj,
            fgzyq : this.form.fgzyq,
            fhbnr : this.form.fhbnr,
            fhydd : this.form.fhydd,
            fhyjssj: this.timeForm.endDate + ' ' + moment(this.timeForm.endTime).format('HH:mm'),
            fhykssj: this.timeForm.startDate + ' ' + moment(this.timeForm.startTime).format('HH:mm'),
            fhynr : this.form.fhynr,
            fjbr : this.form.fjbr,
            fjgfwzxbzyj : this.form.fjgfwzxbzyj,
            fjgfwzxbzyjr : this.form.fjgfwzxbzyjr,
            fjgfwzxbzyjrks : this.form.fjgfwzxbzyjrks,
            fjgfwzxbzyjsj : this.form.fjgfwzxbzyjsj,
            fksdw : fksdwStr,
            fzxld : fzxldStr,
            flczt : this.form.flczt,
            flxdh : this.form.flxdh,
            frq : this.form.frq,
            fsffqlc : this.form.fsffqlc,
            fsfybjbdn: this.form.fsfybjbdn==true?'是':'',
            fsfycs: this.form.fsfycs== true?'是':'',
            fsfykqs: this.form.fsfykqs== true?'是':'',
            fsfytq: this.form.fsfytq== true?'是':'',
            fsfytyy: this.form.fsfytyy== true?'是':'',
            fsfywxht: this.form.fsfywxht== true?'是':'',
            fsfyyx: this.form.fsfyyx== true?'是':'',
            fsfyyxht: this.form.fsfyyxht== true?'是':'',
            fsqbm : this.form.fsqbm,
            fsyks : this.form.fsyks,
            ftyyyjt : this.form.ftyyyjt,
            fwdwry : this.form.fwdwry,
            fwdwrys : this.form.fwdwrys,
            fwxhtyjz : this.form.fwxhtyjz,
            fxxzxjsbzyj : this.form.fxxzxjsbzyj,
            fxxzxjsbzyjr : this.form.fxxzxjsbzyjr,
            fxxzxjsbzyjrks : this.form.fxxzxjsbzyjrks,
            fxxzxjsbzyjsj : this.form.fxxzxjsbzyjsj,
            fyxhtyjz : this.form.fyxhtyjz,
            fzbcsyj : this.form.fzbcsyj,
            fzbcsyjr : this.form.fzbcsyjr,
            fzbcsyjrks : this.form.fzbcsyjrks,
            fzbcsyjsj : this.form.fzbcsyjsj,
            //
            fhyapr : this.form.fhyapr,
            fhyapsj : this.form.fhyapsj,
            fhyapyj : this.form.fhyapyj,
            fhyapks : this.form.fhyapks
        }
        edit(data).then(res => {
            //console.log(res)
            if(res.code == 200){
            this.$message.success(res.message)
            // this.closeVisible()
            } else {
            this.$message.warning(res.message)
            }
        })
        },
        // 退回
        getqueryAllYbJob(){
        queryAllYbJob({jobid:this.form.jobid}).then(res => {
            //console.log(res)
            this.returnList = res.result
        })
        },
        //
        returnChange(value){
        this.returmCheck = value
        },
        //
        returnBtn(){
        let data = {
            jobid: this.form.jobid,
            opinion: this.returnYj,
            shjid: this.returmCheck
        }
        returnUpperzdyFlowJob(data).then(res => {
            if(res.code == 200){
            this.$message.success(res.message)
            let jobid = this.form.jobid
            queryJobByJobId({jobid:jobid}).then(res => {
                //console.log(res)
                this.form = res.result.sqsx
            })
            } else {
            this.$message.warning(res.message)
            }
        })
        },
            // 退回意见
            returnClick(){
                this.$refs.ruleForm.validate(valid => {
                    if (valid){
                        queryAllYbJob({jobid:this.form.jobid}).then(res => {
                            let list = res.result
                            list.forEach(item => {
                                if(item.fhjmc == '申请确认'){
                                    this.returnFuntion(this.form.jobid,item.id)
                                }
                            })
                        })
                    }
                })
            },
            returnFuntion(jobid,ids){
                let returnStr = ''
                if(this.linkName == '科室审批'){
                    returnStr = this.form.fzbcsyj
                } else if(this.linkName == '办公室审批'){
                    returnStr = this.form.fbgsyj
                } else if(this.linkName == '会议安排'){
                    returnStr = this.form.fhyapyj
                }
                let data = {
                    jobid: jobid,
                    opinion: returnStr,
                    shjid: ids,
                    smgflag: '',
                    smsContent: '',
                }
                returnUpperzdyFlowJob(data).then(res => {
                    if(res.code == 200){
                        this.$message.success(res.message)
                        this.closeVisible()
                    } else {
                        this.$message.error(res.message)
                    }
                })
            },
    },
//   updated() {
//     this.$nextTick(() => {
//       if(this.linkName == '科室审批'){
//         this.$refs.refjyInput.focus()
//       } else if(this.linkName == '办公室审批'){
//         this.$refs.refjyeInput.focus()
//       } else if(this.linkName == '会议安排'){
//         if(this.form.fxxzxjsbzyj == ''){
//           this.$refs.refjysInput.focus()
//         }
//       }
//       this.reviewRecordsFocusEvent()
//     })
//   }
}
</script>
<style>
@import url('../../css/oaLess.css');
@import url('../../css/oaClass.css');
</style>
<style lang="less">
.conferenceRoomManagement-form-item {
    .ant-form-item-children {
        display: flex;
    }
}
</style>
